#include <iostream>
using namespace std;
int arrays[30] = {
    3, 4, 7, 9, 8, 10, 14, 10, 7, 9, 
    13, 9, 6, 2, 4, 6, 9, 10, 14, 15,
    10, 13, 9, 10, 6, 8, 9, 10, 13, 9
};

int main(int argc, const char *argv[])
{
    int *min, *max;
    int i;
    int tmp = 0;
    // get the max node of the array
    for (i = 0; i < 30; i++) {
        if (tmp < arrays[i]) {
            tmp = arrays[i];
            max = &arrays[i];
        }
    }
    // get the min node in front of the max node in the array
    for (int *p = max, tmp = *max; p >= arrays; p--) {
        if (tmp > *p) {
            tmp = *p;
            min = p;
        } else {
            continue;
        }
    }

    if (min != max) {
        cout<< "the bug day:" << min-arrays+1 <<endl;
        cout<< "the bug cast:" << *min << endl;
        cout << "the sell day:" << max - arrays + 1 << endl;
        cout<< "the sell cast:" << *max<<endl;
    }

    return 0;
}
